/*  Copyright 2010 Daniel Brasil Magnani
 *  Created on: Dec 20, 2010
 *      Author: daniel */

#include "constructive.h"
#include "exchange.h"
#include "instance.h"
#include "timer.h"

int main(int argc, char* argv[]) {
  srand(time(NULL));

  Instance instance;
  instance.Init(argv[1]);

  std::vector<Constraint> constraint_list;
  constraint_list = instance.get_constraint_list();

  // teste.

  std::vector<Car> yesterday_cars;
  std::vector<Car> today_cars;
  yesterday_cars = instance.get_yesterday_cars();
  today_cars = instance.get_today_cars();

  Timer timer;
  timer.Start();
  while( timer.get_current_time() < 30 ) {
    Constructive constructive(yesterday_cars, today_cars, constraint_list);
    constructive.Execute(yesterday_cars, today_cars, constraint_list);

    std::vector<Car> car_output;
    car_output = constructive.get_solution();

//    Exchange exchange(yesterday_cars.size(), constraint_list.size(), car_output);
//    exchange.ExchangeLocalSearchBest(constraint_list);
//    car_output = exchange.get_solution();
    instance.WriteOutput(car_output);
  }
}
